<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Object.assion</title>
</head>
<body>
  <script>
    var obj = {
      name:'zxw',
      age:18,
      play:[1,2,3]
    }
    var obj2 = Object.assign({},obj)
    console.log(obj2);

    Object.assign = function (target,source) {
      for (const key in source) {
        target[key] = source[key];
      }
      return target
    }
    var obj2 = Object.assign({},obj)
    console.log(obj2);
  </script>
</body>
</html>